using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows.Media;
using Meebey.SmartIrc4net;

namespace Thunder.IrcClient.MessageParser.Default
{
    /// <summary>
    /// Handles the Default message 
    /// </summary>
    internal class MessageParserDefault : MessageParser
    {
        /// <summary>
        /// Gets the type of message handled by the parser
        /// </summary>
        public override ReceiveType MessageType
        {
            get { return ReceiveType.Unknown; }
        }

        /// <summary>
        /// This method is invoked during message parsing.
        /// </summary>
        /// <param name="args">The <see cref="CancelMessageProcessingEventArgs"/> containing the message to be passed</param>
        /// <remarks>You can cancel further processing of the message by setting the <see cref="CancelEventArgs.Cancel"/> to true</remarks>
        protected override void ParseCore(CancelMessageProcessingEventArgs args)
        {
            switch (args.MessageData.ReplyCode)
            {
                case ReplyCode.EndOfExceptionList:
                case ReplyCode.EndOfStats:
                case ReplyCode.EndOfMotd:
                case ReplyCode.EndOfUsers:
                case ReplyCode.EndOfWhoWas:
                case ReplyCode.EndOfLinks:
                case ReplyCode.EndOfWhoIs:
                case ReplyCode.EndOfWho:
                case ReplyCode.EndOfInfo:
                case ReplyCode.EndOfNames:
                case ReplyCode.EndOfBanList:
                case ReplyCode.EndOfInviteList:
                    return;
            }

            this.Manager.WriteStatus(string.Format(CultureInfo.CurrentCulture, "<#{0}> {1}", Localized.UserNameDefault, args.MessageData.Message), Colors.Black);
        }
    }
}